package groovy;

import groovy.text.GStringTemplateEngine
import groovy.global.*;
import groovy2.order.*;

user = new User();
user.id = 11;
user.name = 'Jiming Liu';
user.status = 0;
output = "Hello, ${input}! Hi ${pName}! "
userDetail = "Good groovy user ${user.id}/ ${user.name}/ ${user.status} " + new Date();


def sender = new groovy.User();
sender.name = "Old Liu";

def engine = new GStringTemplateEngine()
println engine.createTemplate(Templates.header).make(['user': user, 'sender': sender])


println engine.createTemplate(Templates.footer).make(['user': user, 'sender': sender])


println binding?.variables

Order order = Order.createRandom(new Random());

println order

// test calling jar class in host JVM - begin

def split_result = com.google.common.base.Splitter.on('|').omitEmptyStrings().limit(3).trimResults().split("aa||bb|cc|dd|ee|ff");
def expected_split_result = ['aa', 'bb', 'cc|dd|ee|ff'] as Set
split_result.each {
    assert expected_split_result.contains(it);
}

// test calling jar class in host JVM - end
